package com.agy.filemanager.controller;


import com.agy.filemanager.common.TreeUtil;
import com.agy.filemanager.entity.TreeModel;
import com.agy.filemanager.service.DcSystemService;
import com.agy.filemanager.toolClass.Result;
import com.agy.filemanager.toolClass.ResultUtil;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


/**
 * 系统设置-
 */
@Controller
@RequestMapping("/system")
public class SystemController {

    @Autowired
    private DcSystemService dcSystemService;

    /**
     * -系统设置页面
     * @return  index.ftl 系统设置页面
     */
    @GetMapping("/index")
    public String doView01(){
        return "system/index";
    }

    /**
     * -获取系统设置下的二级菜单列表
     * @param father_id
     * @return
     */
    @PostMapping("/getMenuTree")
    @ResponseBody
    public Result getMenuTree(@RequestParam("father_id") String father_id) {
        List<TreeModel> list = TreeUtil.getTree(this.dcSystemService.selectMenusBy(father_id));
        return ResultUtil.success(list, "成功");
    }

    /**
     * -系统管理员维护页面
     * @return
     */
    @GetMapping("/ManagerInfo")
    public String doView02(){
        return "system/managerInfo/index";
    }

    /**
     * 安工院组织人员维护页面
     * @return
     */
    @GetMapping("/agyOrgUser")
    public String doView03(){
        return "system/agyOrgUser/index";
    }

    /**
     * 角色维护
     * @return
     */
    @GetMapping("/baseRole")
    public String doView04(){
        return "system/baseRole/index";
    }

    /**
     * 项目大类
     * @return
     */
    @GetMapping("/projectMainType")
    public String doView05(){
        return "system/projectMainType/index";
    }

    /**
     * 项目阶段
     * @return
     */
    @GetMapping("/projectStage")
    public String doView06(){
        return "system/projectStage/index";
    }

    /**
     * 菜单维护
     * @return
     */
    @GetMapping("/baseMenu")
    public String doView07(){
        return "system/baseMenu/index";
    }

    /**
     * 角色维护
     * @return
     */
    @GetMapping("/baseUserRole")
    public String doView08(){
        return "system/baseUserRole/index";
    }

    /**
     * 中石化组织机构
     * @return
     */
    @GetMapping("/sinopec")
    public String doView10(){
        return "system/sinopec/index";
    }

    /**
     * 角色菜单维护
     * @return
     */
    @GetMapping("/baseRoleMenu")
    public String doView09(){
        return "system/baseRoleMenu/index";
    }

    /**
     * 申请借阅
     * @return
     */
    @GetMapping("/applyFor")
    public String doView11(){
        return "system/applyFor/index";
    }
}
